package com.lgrousset.loanssimulator.client.chart;

import com.google.gwt.event.logical.shared.CloseEvent;
import com.google.gwt.event.logical.shared.CloseHandler;
import com.google.gwt.event.logical.shared.OpenEvent;
import com.google.gwt.event.logical.shared.OpenHandler;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.DisclosurePanel;
import com.google.gwt.user.client.ui.HTML;
import com.lgrousset.loanssimulator.client.chart.widget.LoansVisualizationAndFields;

public class ChartDisclosurePanel extends Composite {
	private DisclosurePanel panel = new DisclosurePanel();

	public ChartDisclosurePanel() {

		panel.setAnimationEnabled(true);
		panel.setStyleName("chartDisclosurePanel");
		panel.setHeader(new HTML("Click Here To Open"));
		panel.add(new LoansVisualizationAndFields());

		panel.addOpenHandler(new OpenHandler<DisclosurePanel>() {

			@Override
			public void onOpen(OpenEvent<DisclosurePanel> event) {
				panel.setHeader(new HTML("Click Here To Close"));
			}
		});

		panel.addCloseHandler(new CloseHandler<DisclosurePanel>() {

			@Override
			public void onClose(CloseEvent<DisclosurePanel> event) {
				panel.setHeader(new HTML("Click Here To Open"));
			}
		});

		initWidget(panel);
	}
}
